/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.gm.entities;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.Lob;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Med EL MOUDDENE
 */
@Entity
@Table(name = "personne")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Personne.findAll", query = "SELECT p FROM Personne p"),
    @NamedQuery(name = "Personne.findByIdPersonne", query = "SELECT p FROM Personne p WHERE p.idPersonne = :idPersonne"),
    @NamedQuery(name = "Personne.findByDateNaissance", query = "SELECT p FROM Personne p WHERE p.dateNaissance = :dateNaissance"),
    @NamedQuery(name = "Personne.findByDateIntegration", query = "SELECT p FROM Personne p WHERE p.dateIntegration = :dateIntegration"),
    @NamedQuery(name = "Personne.findByDateRdv", query = "SELECT p FROM Personne p WHERE p.dateRdv = :dateRdv")})
public class Personne implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_PERSONNE")
    private Integer idPersonne;
    @Lob
    @Size(max = 65535)
    @Column(name = "CIN")
    private String cin;
    @Lob
    @Size(max = 65535)
    @Column(name = "NOM")
    private String nom;
    @Lob
    @Size(max = 65535)
    @Column(name = "PRENOM")
    private String prenom;
    @Lob
    @Size(max = 65535)
    @Column(name = "SEXE")
    private String sexe;
    @Column(name = "DATE_NAISSANCE")
    @Temporal(TemporalType.DATE)
    private Date dateNaissance;
    @Lob
    @Size(max = 65535)
    @Column(name = "CP")
    private String cp;
    @Lob
    @Size(max = 65535)
    @Column(name = "ADRESSE")
    private String adresse;
    @Lob
    @Size(max = 65535)
    @Column(name = "TELEPHONE1")
    private String telephone1;
    @Lob
    @Size(max = 65535)
    @Column(name = "TELEPHONE2")
    private String telephone2;
    @Column(name = "DATE_INTEGRATION")
    @Temporal(TemporalType.DATE)
    private Date dateIntegration;
    @Column(name = "DATE_RDV")
    @Temporal(TemporalType.DATE)
    private Date dateRdv;
    @Lob
    @Column(name = "PHOTO")
    private byte[] photo;
    @Lob
    @Size(max = 65535)
    @Column(name = "AUTORISATION_PATERNELLE_D_ACCOMPAGNEMENT_D_ENFANT_PAR_NOM")
    private String autorisationPaternelleDAccompagnementDEnfantParNom;
    @Lob
    @Size(max = 65535)
    @Column(name = "AUTORISATION_PATERNELLE_D_ACCOMPAGNEMENT_D_ENFANT_PAR_TEL")
    private String autorisationPaternelleDAccompagnementDEnfantParTel;
    @Lob
    @Size(max = 65535)
    @Column(name = "PERSONNE_CAS_URGENCE_NOM")
    private String personneCasUrgenceNom;
    @Lob
    @Size(max = 65535)
    @Column(name = "PERSONNE_CAS_URGENCE_TEL")
    private String personneCasUrgenceTel;
    @Lob
    @Size(max = 65535)
    @Column(name = "ENFANT_A_T_IL_ETE_EVE_PAR_SES_PARENTS_")
    private String enfantATIlEteEveParSesParents;
    @Lob
    @Size(max = 65535)
    @Column(name = "ELEVE_PAR_QUI_NOM")
    private String eleveParQuiNom;
    @JoinTable(name = "handicap_personne", joinColumns = {
        @JoinColumn(name = "ID_PERSONNE", referencedColumnName = "ID_PERSONNE")}, inverseJoinColumns = {
        @JoinColumn(name = "ID_HANDICAP", referencedColumnName = "ID_HANDICAP")})
    @ManyToMany
    private Collection<Handicape> handicapeCollection;
    @JoinTable(name = "frere", joinColumns = {
        @JoinColumn(name = "ID_PERSONNE", referencedColumnName = "ID_PERSONNE")}, inverseJoinColumns = {
        @JoinColumn(name = "ID_FRERE", referencedColumnName = "ID_PERSONNE")})
    @ManyToMany
    private Collection<Personne> personneCollection;
    @ManyToMany(mappedBy = "personneCollection")
    private Collection<Personne> personneCollection1;
    @JoinColumn(name = "ID_SITUATION", referencedColumnName = "ID_SITUATION")
    @ManyToOne(optional = false)
    private SituationFamiliale idSituation;
    @OneToMany(mappedBy = "idPere")
    private Collection<Personne> personneCollection2;
    @JoinColumn(name = "ID_PERE", referencedColumnName = "ID_PERSONNE")
    @ManyToOne
    private Personne idPere;
    @OneToMany(mappedBy = "idMere")
    private Collection<Personne> personneCollection3;
    @JoinColumn(name = "ID_MERE", referencedColumnName = "ID_PERSONNE")
    @ManyToOne
    private Personne idMere;
    @JoinColumn(name = "ID_QUARTIER", referencedColumnName = "ID_QUARTIER")
    @ManyToOne(optional = false)
    private Quartier idQuartier;
    @JoinColumn(name = "ID_PROFILE", referencedColumnName = "ID_PROFILE")
    @ManyToOne(optional = false)
    private Profile idProfile;
    @JoinColumn(name = "ID_NIVEAU", referencedColumnName = "ID_NIVEAU")
    @ManyToOne(optional = false)
    private Scolarite idNiveau;
    @JoinColumn(name = "ID_GROUPE", referencedColumnName = "ID_GROUPE")
    @ManyToOne
    private Groupe idGroupe;
    @JoinColumn(name = "ID_PRISE_EN_CHARGE", referencedColumnName = "ID_PRISE_EN_CHARGE")
    @ManyToOne(optional = false)
    private PriseEnCharge idPriseEnCharge;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "personne")
    private Collection<ReeducationConcernantPersonne> reeducationConcernantPersonneCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idPersonne")
    private Collection<Ordonnance> ordonnanceCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "personne")
    private Collection<InscriptionAssociation> inscriptionAssociationCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idPersonne")
    private Collection<DossierMedical> dossierMedicalCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "personne")
    private Collection<SubirExamenRemarque> subirExamenRemarqueCollection;

    public Personne() {
    }

    public Personne(Integer idPersonne) {
        this.idPersonne = idPersonne;
    }

    public Integer getIdPersonne() {
        return idPersonne;
    }

    public void setIdPersonne(Integer idPersonne) {
        this.idPersonne = idPersonne;
    }

    public String getCin() {
        return cin;
    }

    public void setCin(String cin) {
        this.cin = cin;
    }

    public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }

    public String getPrenom() {
        return prenom;
    }

    public void setPrenom(String prenom) {
        this.prenom = prenom;
    }

    public String getSexe() {
        return sexe;
    }

    public void setSexe(String sexe) {
        this.sexe = sexe;
    }

    public Date getDateNaissance() {
        return dateNaissance;
    }

    public void setDateNaissance(Date dateNaissance) {
        this.dateNaissance = dateNaissance;
    }

    public String getCp() {
        return cp;
    }

    public void setCp(String cp) {
        this.cp = cp;
    }

    public String getAdresse() {
        return adresse;
    }

    public void setAdresse(String adresse) {
        this.adresse = adresse;
    }

    public String getTelephone1() {
        return telephone1;
    }

    public void setTelephone1(String telephone1) {
        this.telephone1 = telephone1;
    }

    public String getTelephone2() {
        return telephone2;
    }

    public void setTelephone2(String telephone2) {
        this.telephone2 = telephone2;
    }

    public Date getDateIntegration() {
        return dateIntegration;
    }

    public void setDateIntegration(Date dateIntegration) {
        this.dateIntegration = dateIntegration;
    }

    public Date getDateRdv() {
        return dateRdv;
    }

    public void setDateRdv(Date dateRdv) {
        this.dateRdv = dateRdv;
    }

    public byte[] getPhoto() {
        return photo;
    }

    public void setPhoto(byte[] photo) {
        this.photo = photo;
    }

    public String getAutorisationPaternelleDAccompagnementDEnfantParNom() {
        return autorisationPaternelleDAccompagnementDEnfantParNom;
    }

    public void setAutorisationPaternelleDAccompagnementDEnfantParNom(String autorisationPaternelleDAccompagnementDEnfantParNom) {
        this.autorisationPaternelleDAccompagnementDEnfantParNom = autorisationPaternelleDAccompagnementDEnfantParNom;
    }

    public String getAutorisationPaternelleDAccompagnementDEnfantParTel() {
        return autorisationPaternelleDAccompagnementDEnfantParTel;
    }

    public void setAutorisationPaternelleDAccompagnementDEnfantParTel(String autorisationPaternelleDAccompagnementDEnfantParTel) {
        this.autorisationPaternelleDAccompagnementDEnfantParTel = autorisationPaternelleDAccompagnementDEnfantParTel;
    }

    public String getPersonneCasUrgenceNom() {
        return personneCasUrgenceNom;
    }

    public void setPersonneCasUrgenceNom(String personneCasUrgenceNom) {
        this.personneCasUrgenceNom = personneCasUrgenceNom;
    }

    public String getPersonneCasUrgenceTel() {
        return personneCasUrgenceTel;
    }

    public void setPersonneCasUrgenceTel(String personneCasUrgenceTel) {
        this.personneCasUrgenceTel = personneCasUrgenceTel;
    }

    public String getEnfantATIlEteEveParSesParents() {
        return enfantATIlEteEveParSesParents;
    }

    public void setEnfantATIlEteEveParSesParents(String enfantATIlEteEveParSesParents) {
        this.enfantATIlEteEveParSesParents = enfantATIlEteEveParSesParents;
    }

    public String getEleveParQuiNom() {
        return eleveParQuiNom;
    }

    public void setEleveParQuiNom(String eleveParQuiNom) {
        this.eleveParQuiNom = eleveParQuiNom;
    }

    @XmlTransient
    public Collection<Handicape> getHandicapeCollection() {
        return handicapeCollection;
    }

    public void setHandicapeCollection(Collection<Handicape> handicapeCollection) {
        this.handicapeCollection = handicapeCollection;
    }

    @XmlTransient
    public Collection<Personne> getPersonneCollection() {
        return personneCollection;
    }

    public void setPersonneCollection(Collection<Personne> personneCollection) {
        this.personneCollection = personneCollection;
    }

    @XmlTransient
    public Collection<Personne> getPersonneCollection1() {
        return personneCollection1;
    }

    public void setPersonneCollection1(Collection<Personne> personneCollection1) {
        this.personneCollection1 = personneCollection1;
    }

    public SituationFamiliale getIdSituation() {
        return idSituation;
    }

    public void setIdSituation(SituationFamiliale idSituation) {
        this.idSituation = idSituation;
    }

    @XmlTransient
    public Collection<Personne> getPersonneCollection2() {
        return personneCollection2;
    }

    public void setPersonneCollection2(Collection<Personne> personneCollection2) {
        this.personneCollection2 = personneCollection2;
    }

    public Personne getIdPere() {
        return idPere;
    }

    public void setIdPere(Personne idPere) {
        this.idPere = idPere;
    }

    @XmlTransient
    public Collection<Personne> getPersonneCollection3() {
        return personneCollection3;
    }

    public void setPersonneCollection3(Collection<Personne> personneCollection3) {
        this.personneCollection3 = personneCollection3;
    }

    public Personne getIdMere() {
        return idMere;
    }

    public void setIdMere(Personne idMere) {
        this.idMere = idMere;
    }

    public Quartier getIdQuartier() {
        return idQuartier;
    }

    public void setIdQuartier(Quartier idQuartier) {
        this.idQuartier = idQuartier;
    }

    public Profile getIdProfile() {
        return idProfile;
    }

    public void setIdProfile(Profile idProfile) {
        this.idProfile = idProfile;
    }

    public Scolarite getIdNiveau() {
        return idNiveau;
    }

    public void setIdNiveau(Scolarite idNiveau) {
        this.idNiveau = idNiveau;
    }

    public Groupe getIdGroupe() {
        return idGroupe;
    }

    public void setIdGroupe(Groupe idGroupe) {
        this.idGroupe = idGroupe;
    }

    public PriseEnCharge getIdPriseEnCharge() {
        return idPriseEnCharge;
    }

    public void setIdPriseEnCharge(PriseEnCharge idPriseEnCharge) {
        this.idPriseEnCharge = idPriseEnCharge;
    }

    @XmlTransient
    public Collection<ReeducationConcernantPersonne> getReeducationConcernantPersonneCollection() {
        return reeducationConcernantPersonneCollection;
    }

    public void setReeducationConcernantPersonneCollection(Collection<ReeducationConcernantPersonne> reeducationConcernantPersonneCollection) {
        this.reeducationConcernantPersonneCollection = reeducationConcernantPersonneCollection;
    }

    @XmlTransient
    public Collection<Ordonnance> getOrdonnanceCollection() {
        return ordonnanceCollection;
    }

    public void setOrdonnanceCollection(Collection<Ordonnance> ordonnanceCollection) {
        this.ordonnanceCollection = ordonnanceCollection;
    }

    @XmlTransient
    public Collection<InscriptionAssociation> getInscriptionAssociationCollection() {
        return inscriptionAssociationCollection;
    }

    public void setInscriptionAssociationCollection(Collection<InscriptionAssociation> inscriptionAssociationCollection) {
        this.inscriptionAssociationCollection = inscriptionAssociationCollection;
    }

    @XmlTransient
    public Collection<DossierMedical> getDossierMedicalCollection() {
        return dossierMedicalCollection;
    }

    public void setDossierMedicalCollection(Collection<DossierMedical> dossierMedicalCollection) {
        this.dossierMedicalCollection = dossierMedicalCollection;
    }

    @XmlTransient
    public Collection<SubirExamenRemarque> getSubirExamenRemarqueCollection() {
        return subirExamenRemarqueCollection;
    }

    public void setSubirExamenRemarqueCollection(Collection<SubirExamenRemarque> subirExamenRemarqueCollection) {
        this.subirExamenRemarqueCollection = subirExamenRemarqueCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idPersonne != null ? idPersonne.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Personne)) {
            return false;
        }
        Personne other = (Personne) object;
        if ((this.idPersonne == null && other.idPersonne != null) || (this.idPersonne != null && !this.idPersonne.equals(other.idPersonne))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.gm.entities.Personne[ idPersonne=" + idPersonne + " ]";
    }
    
}
